home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1997 / HAM Radio 1997.iso / vcls / sprites / spritest.txt < prev    next >
Text File  |  1996-04-08  |  10KB  |  226 lines

  1. Real Time Scaleable Sprites 
  2. Components
  3. for
  4. Borland Delphi
  5. Copyright 1995 by:
  6. Marek A. Chmielowski  
  7. All rights reserved - see disclaimer  at the end of this document.
  8.  
  9.  
  10. Description
  11. Real Time Scaleable Sprites for Borland's Delphi consists of two 
  12. components:
  13. 1 animation background component - MChSpriteBgr  
  14. 2 sprite component - MChSprite  
  15. Animation background and transparent sprites (up to 100) are created as 
  16. instances of corresponding components by double clicking on Delphi 
  17. component palette and by selecting proper image (e.g. bitmap) with 
  18. Object Inspector property editor (Picture Editor). All initialisation is handled 
  19. by components themselves. Instance of MChSprite can be moved on 
  20. instance of MChSpriteBgr with single method call e.g. 
  21. MChSprite1.SprGo(From, Dest, AtTime). Sprite position is determined by 
  22. real time clock and is independent on computer and graphic cart 
  23. performance (slow cart results in jetted movements). Sprites are 
  24. implemented as autonomous objects and support transparent colour, 
  25. collision, Z-order (overlapping), Z-order dynamic change, sprite scaling, 
  26. dynamic scale change, image flipping, linear movement and movement 
  27. along curve. Sprites can respond to mouse pointer and can be drag with 
  28. mouse to new position. Sprite movement can be synchronised with sound 
  29. effects.
  30. Source code for components and demo program is provided in PKzip 
  31. compressed package  .
  32. These components and source code is FREE  for non-profit applications - 
  33. see copyright information and disclaimer  at the end of this document. 
  34.  
  35.  
  36. Package
  37. Source  code for Sprites components and demo  programs (also 
  38. executable  for IBM-PC and Windows 3.1) is in PKzip compressed 
  39. package sprites.zip  . To get sprites.zip  package from: 
  40. http://sunsite.icm.edu.pl/archive/delphi/ftp/freeware/sprites.zip  double 
  41. click on any "sprites.zip  " name and then on highlighted http external link.
  42. PkZip package sprites.zip  
  43. contains:
  44.   Sprites.htm This file  
  45.   Spritest.txt Text only version of this file  (it is NOT nicely formatted)
  46.   Sprites.txt Note for BBS operator
  47.   SprDemo2.exe Compiled colliding sprites demo
  48.   SprDemo3.exe Compiled mouse aware demo
  49.   MChSpBg.pas source code for background component
  50.   MChSprt.pas source code for sprite component
  51.   SpritesH.hlp help file for background component
  52.   SpritesH.kwf keyword file for background component
  53.   SprDemo0.dpr project source code for very simple demo
  54.   SprDemo1.dpr project source code for simple demo
  55.   SprDemo2.dpr project source code for colliding sprites demo
  56.   SprDemo3.dpr project source code for mouse aware demo
  57.   SprDmSB2.dpr project source code for colliding sprites demo using 
  58. Sound Blaster
  59.   UntDemo0.pas unit source code for very simple demo
  60.   UntDemo0.dfm form file for very simple demo
  61.   UntDemo1.pas unit source code for simple demo
  62.   UntDemo1.dfm form file for simple demo
  63.   UntDemo2.pas unit source code for colliding sprites demo
  64.   UntDemo2.dfm form file for colliding sprites demo
  65.   UntDemo3.pas unit source code for mouse aware demo
  66.   UntDemo3.dfm form file for mouse aware demo
  67.   UntDmSB2.pas unit source code for colliding sprites demo using 
  68. Sound Blaster
  69.   UntDmSB2.dfm form file for colliding sprites demo using Sound 
  70. Blaster
  71. To unpack type on IBM-PC compatible computer type:
  72. pkunzip sprites.zip  
  73.  
  74.  
  75. Demos
  76. You can run SprDemo2.exe  and SprDemo3.exe  demos on IBM-PC 
  77. compatible computer from Windows 3.1 without installing components 
  78. (you can run them without Delphi at all). Do NOT load their source code 
  79. into Delphi before installing  Sprites components. Demo using Sound 
  80. Blaster compatible cart: SprDm2SB.dpr  is provided in source code 
  81. version only, because I do not have rights to distribute samples of sound 
  82. files provided with my Sound Blaster card. Please edit filename property of 
  83. multimedia components in SprDmSB2.dfm  form to select your sound 
  84. files - see Delphi help about TMultimediaComponent and it's properties. 
  85. For Sound Blaster 16 I have used s_8_22.wav and jazz.mid for 
  86. MediaPlayer 1 and 2 respectively.
  87. Both executables are running fine on my desktop PC and on my laptop, 
  88. however they are crashing at my PC at work. I suspect that Windows 
  89. driver is incompatible with Delphi expectation, but I do not intent to bother. 
  90. If demos (executables) are not working and this will not discourage you 
  91. from using this software (it should) just tray install components and 
  92. recompile demo source code. 
  93.  
  94.  
  95. Installing Sprites Components
  96. Read first Delphi User's Manual - page 68.
  97. My comments:
  98. 1 First of all backup COMPLIB.DCL - it should be in delphi/lib 
  99. directory. DO NOT be sorry if compilation will go wrong - I 
  100. WARNED you. (Do not panic either - you can get original 
  101. COMPLIB.DCL from Borland's distribution disk(s).)
  102. 2 Copy mchspbg.pas  and mchsprt.pas  into your non-Borland 
  103. components directory (It is nice to have one and not mess 
  104. original components with freeware junk e.g. 
  105. Real Time Scaleable Sprites  )
  106. 3 From Delphi IDE - select Options|Install Components, Add, 
  107. Browse - and double click on mchspbg.pas  then on 
  108. mchsprt.pas  
  109. 4 Hit OK to install new Components - They should appear on your 
  110. 'Sample' palette
  111.  
  112.  
  113. Testing
  114. Run SprDemo2.exe  first - you can do this before installing components 
  115. into Delphi.
  116. If you like what you have seen - instal components  .
  117. Test SprDemo1 source code  first:
  118. Open Project SprDemo1.dpr  , than open Form1 and from Object 
  119. Inspector:
  120. 1 In MChSpriteBgr1 edit field "Picture" - click on three dots - then 
  121. select your bitmap as background (do not select to large one first 
  122. - you may run into memory problem as several copies of 
  123. background image will be made)
  124. 2 In MChSprite1 and MChSprite2 edit field Bitmap -- click on three 
  125. dots - then select your bitmap as sprite (pick up really small one 
  126. - see in Delphi/images/splash/colors16)
  127. 3 In MChSprite1 and MChSprite2 edit SprTrColor - pick up colour 
  128. to be transparent
  129. Run SprDemo1 with yours background and yours sprites
  130. From now you are on your own - tray SprDemo2.dpr  and then 
  131. SprDemo3.dpr  . Read help file  and look at the code UntDemo0.pas  , 
  132. UntDemo1.pas  , UntDemo2.pas  , and UntDemo3.pas  . If you have 
  133. Sound Cart look also at UntDm2SB.pas  .
  134. Send me e-mail  if you like or hate this package  .
  135.  
  136.  
  137. Installing the Help Files
  138. See Delphi Component Writer's Guide page 80.
  139. If you have trouble in understanding Borland's documentation (I had) you 
  140. can use SpritesH.hlp  directly from Windows:
  141. Associate extension .hlp with WinHelp and just double click on spritesh.hlp  
  142. (You can read Sprites help but there is no link from Delphi). You can also 
  143. create New program Item WinHelp spritesh.hlp  from program Manager.
  144. To have help available from Delphi IDE on pressing F1 (it should display 
  145. help when cursor is on Component Palette, if Sprite or Sprite Background 
  146. component are selected on Form, or if TMChSprite or TMChSpriteBgr 
  147. words are selected in source editor) is more complex:
  148.   copy spritesh.kwf  to delphi/help and spritesh.hlp  to delphi/bin
  149.   run delphi/help/helpinst.exe (there is an icon in Delphi group):
  150. 1.1 Open delphi/bin/delphi.hdx
  151. 1.2 Press "+" and select spritesh.kwf
  152. 1.3 Press "Save"
  153.  
  154.  
  155. References and Comments About 
  156. Used Programming Technique 
  157. Real Time Scaleable Sprites have been implemented using autonomous 
  158. object approach as opposite to frame based technique  . Movement, 
  159. visibility, and scale of each sprite is determined only by sprite itself (i.e. by 
  160. it's properties). This way only single image for sprite is required and there 
  161. is no need for huge filmstrip bitmaps required by frame animation. 
  162. Background component  is resolving conflicting request from sprites  (e.g. 
  163. request from two sprites to be display in the same place) and synchronise 
  164. screen update in flicker free fashion.
  165. Sprites components have been developed on the base of excellent book  
  166. about animation in Windows by Nigel Thompson. The only drawback I 
  167. have found in this book are programming examples based on non-
  168. structured, non-modular, and with messy syntax C++ computer slang.
  169. Animation techniques in Win32, by Nigel Thompson, Microsoft 
  170. Programming Series, Microsoft Press.
  171. If you are allergic to C++ (I am) you can find Delphi Object Pascal 
  172. examples illustrating basic techniques of using transparent bitmaps on 
  173. newsgroup comp.lang.pascal:
  174. Very simple and concise:
  175. Transparent Bitblt - by Bryan Zarnett
  176. http://sunsite.icm.edu.pl/archive/delphi/ftp/from_news/9.txt  
  177. Somewhat more complex and showing very strong C heritage:
  178. Transparent Bitmap - by Michael Vincze
  179. http://sunsite.icm.edu.pl/archive/delphi/ftp/from_news/7.txt  
  180. For easy to understand Delphi example of simple object based 
  181. animation see very nice example:
  182. Flickerless Sprite Animation - by David R. McDermitt in freeware section
  183. http://sunsite.icm.edu.pl/archive/delphi/ftp/freeware/copyrect.zip  
  184. Example of Delphi frame based animation component can be found in 
  185. shareware section
  186. Animation component by Dare Baldwin (free for freeware writers)
  187. http://sunsite.icm.edu.pl/archive/delphi/ftp/shareware/animate.zip  
  188.  
  189.  
  190. Copyright Information and 
  191. Disclaimer 
  192. These components and source code is FREE for non-profit applications. 
  193. This package may be copied and distributed freely providing that it is not 
  194. modified, no fee is charged, and it is not used by package for which a 
  195. charge is made.
  196. Use this package entirely on your own risk as no warranty is provided. 
  197. Even if this software will cause the whole universe to blow I will be 
  198. responsible only to God.
  199. (Will you DARE to press Super Nova button in SprDemo3 now.)
  200. Please do NOT distribute components or source code if you altered them 
  201. -
  202. EVEN IF THIS IS ONLY BUG CORRECTION.
  203. Let me  know about the problem and the solution and I will implement it in 
  204. the next
  205. version (may be it will be the next version). Also suggestions are 
  206. appreciated.
  207. If you would like to use this components for shareware or commercial 
  208. application
  209. please contact me first by mail  :
  210. My (Marek Chmielowski) e-mail:
  211. on Compuserve: 76360,2775
  212. on Internet: 76360,2775@compuserve.com
  213. Mail:
  214. Marek Chmielowski
  215. 5/56 Kozia St.
  216. Warsaw 00-070
  217. Poland
  218. (48) (22) 226-01-85
  219. or
  220. Marek Chmielowski
  221. 10005 Broad St.
  222. Bethesda, MD 20814
  223. USA
  224. (301) 897-5266 
  225.  
  226.